home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / jjbqc.zip / JJBSHOW4.C < prev    next >
C/C++ Source or Header  |  1993-01-04  |  9KB  |  194 lines

  1.  
  2.  
  3.  
  4.  
  5. /**************************************************************************
  6.  *                                                                        *
  7.  *                           JJBSHOW4.C                                   *
  8.  *                                                                        *
  9.  *   Copyright (c) 1989, JJB. All rights reserved.                        *
  10.  *                                                                        *
  11.  *   The purpose of JJB is to help you to write programs as quickly       *
  12.  *   as possible. JJB handles things for you and provides you with        *
  13.  *   an environment which allows you to concentrate on the functions      *
  14.  *   of your program.                                                     *
  15.  *                                                                        *
  16.  *   This example shows you how to use the following functions:           *
  17.  *                                                                        *
  18.  *      jjb_initalize()            initalizes JJB.                        *
  19.  *      jjb_setup()                sets up the JJB option arrays.         *
  20.  *      jjb_start()                begins executing the default option.   *
  21.  *                                                                        *
  22.  *      group(group description)   start setting up a group of options &  *
  23.  *                                  assign a description to the group.    *
  24.  *                                                                        *
  25.  *      option(option description) sets up an option.                     *
  26.  *                                                                        *
  27.  *      funct(function name)       assigned a function to the option.     *
  28.  *      default_opt()              assigns default to an option           *
  29.  *      help(functionname)        assigns a function to F1 help.         *
  30.  *                                                                        *
  31.  *                                                                        *
  32.  *   If you are looking at this file from DOS, you need to first read     *
  33.  *   JJBREAD.ME file and follow the instructions.                         *
  34.  *                                                                        *
  35.  *   You may now press 'F5' to compile and begin executing.               *
  36.  *                                                                        *
  37.  *     JJB, 9236 church Rd suite 1082, Dallas, Tx 75231 (214) 341-1635    *
  38.  **************************************************************************/
  39.  
  40. /***************************************************************************
  41.  *                                                                         *
  42.  * To make an .exe file JJBSHOW4.EXE for this program, from DOS enter:     *
  43.  *                                                                         *
  44.  *     QCL  /c  /AM  JJBSHOW4.C                                            *
  45.  *     LINK  JJBSHOW4.OBJ + JJB.OBJ + JJBINPUT.OBJ,,, C:LIB\,              *
  46.  *                                                                         *
  47.  ***************************************************************************/
  48.  
  49. #include "c:\bin\jjbkbd.h"
  50. #include "c:\bin\jjbset.h"
  51.  
  52.  
  53. main() {
  54.  
  55.     jjb_initalize();      /* initalize JJB arrays and video screen */
  56.  
  57.     jjb_setup();          /* set up the options */
  58.  
  59.     jjb_start();          /* start executing the default option   */
  60.  
  61.     }
  62.  
  63.  
  64.  
  65. /****************************************************************************
  66.  *                                                                          *
  67.  *                        sample_function()                                 *
  68.  *                                                                          *
  69.  *   This is a sample function which is assigned to the options             *
  70.  *   to show you how functions can be executed when you select              *
  71.  *   an option.                                                             *
  72.  *                                                                          *
  73.  *   if you do not assign a function to each option, JJB will initalize     *
  74.  *                                                                          *
  75.  *   each option with a null function which just gets a character.          *
  76.  *                                                                          *
  77.  ****************************************************************************/
  78.  
  79.  
  80. /* Below is just a sample of some of the video fast 'vf' functions          */
  81. /*   you will be able to use in the JJB hidden library, see JJBREAD.ME      */
  82.  
  83. /* 'vfs(string)'         video fast a string direct to video memory.        */
  84. /* 'vfscr(string,2,14)'  sets up all subsequent 'vfscr' for down 2 over 14  */
  85. /* 'vfscr(string)'       does 2 carr. rets and goes over to column 14       */
  86. /* All the 'vf' functions are portable and work for all video controllers   */
  87. /* vfs(string does not affect cursor. 'vfsc(string)' places cursor after    */
  88. /* The complete set of 'vf' functions are explained in the                  */
  89. /*         written documentation from JJB.                                  */
  90.  
  91.  
  92. sample_help() {
  93.      vsave_screen();  /* save the screen   */
  94.      vclr_screen();   /* clear the screen  */
  95.      vloc(6,14);      /* position for video fast functions */
  96.  
  97.       /* 'vfscr(' videos fast a string and then does a carriage ret.
  98.          '2,14' sets up all subsequent to come down two and over 14. */
  99.  
  100.      vfscr("F1 is reserved for help.",2,14);
  101.  
  102.      vfscr("You can set up a function and call it by using the F1 key.");
  103.      vfscr("JJB will use whatever function you assign in jjb_setup().");
  104.      vfscr("In this example, jjb_setup assigns sample_help() as follows:");
  105.      vfscr("      'help(sample_help);'",3);
  106.      vfsc( pak() );     /* video fast 'Press any key'and put cursor after  */
  107.      getch();           /* getch() is ok here.                             */
  108.      vrest_screen();    /* restore the screen                              */
  109.      }
  110.  
  111. sample_function()  {  char str[31]; char *sp = "  ";
  112.  
  113.  vloc(4,8);        /* prepare for a video fast at row 4, column 8  */
  114.  vfscr("Look at the file JJBSHOW4.C to see how JJB works.",2,8);
  115.  vfscr("JJB may be used for any programming application.");
  116.  vfs("JJB LA (Large Application)");
  117.  vfscr(" is to be released in the spring of 1989.",3,8);
  118.  vfscr("At any time while typing, you may press ALT and change options.",2,8);
  119.  vfscr("The option selected is displayed in bottom left corner.");
  120.  
  121.    while (1)
  122.       {
  123.     /* see JJBSHOW5.C for an example of how you can use the enter   */
  124.     /* functions to input entire screens of data.                   */
  125.  
  126.     enter(16,20,"Enter a string ",&str[0],30);
  127.     enter(18,20,"Press any key ",&str[0],1);
  128.  
  129.     vloc(18,20); vspaces(55);   /* clear press any key.    */
  130.  
  131.  
  132.     }
  133. }
  134.  
  135.  
  136. /****************************************************************************
  137.  *                                                                          *
  138.  *                       jjb_setup()                                        *
  139.  *                                                                          *
  140.  *   jjb_setup() is where you set up all your program option descriptions   *
  141.  *      and assign function names to each option.                           *
  142.  *                                                                          *
  143.  ****************************************************************************/
  144.  
  145. /*  The groups and options descriptions being set up have no meaning.      */
  146. /*  Any description can be chosen.                                         */
  147. /*  Try changing them and see what happens when you press 'F5'.            */
  148. /*  Some of the options below do not have a function assigned to them.     */
  149. /*  To keep this example simple, more than one function is assigned to     */
  150. /*     the sample function. Normally, you would not assign a function      */
  151. /*     to more than one option.                                            */
  152. /*                                                                         */
  153.  
  154. jjb_setup() {
  155.  
  156.     group("Application");          /* this starts a group of options */
  157.  
  158.         option("Applications Test #1");
  159.             funct(sample_function);
  160.         option("Applications 'V'ideo Test");
  161.             funct(sample_function);
  162.  
  163.         option("Applications 'D'isk  Test");
  164.             funct(sample_function);
  165.             default_opt();   /* start with this option          */
  166.  
  167.         option("C'o'mmunicatyion Test");
  168.             funct(sample_function);
  169.  
  170.  
  171.     group("Reports");          /* this starts a group of options */
  172.  
  173.         option("General ledger F7");    /* assign F7 to this option */
  174.         option("Trial Balance");
  175.             funct(sample_function);
  176.         option("Chart of Accounts Report");
  177.             funct(sample_function);
  178.         option("Profit & Loss");
  179.             funct(sample_function);
  180.         option("Balance Sheet",DRAWLINE); /* DRAWLINE separates */
  181.             funct(sample_function);
  182.         option("More Reports");
  183.             funct(sample_function);
  184.  
  185.     group("More");
  186.         option("Miscellaneous Options");
  187.         option("Month-end Closing");
  188.  
  189.     help(sample_help);
  190.  
  191.     }
  192.  
  193.  
  194.